# include <stdio.h>

int push(int *a, int top, int elem);
int pop(int *a, int top);

int main(void)
{
    int top = -1;
    int a[3] = {0};
    top = push(a, top, 1);
    top = push(a, top, 2);
    top = push(a, top, 3);
    top = pop(a, top);
    top = pop(a, top);
    top = pop(a, top);
    top = pop(a, top);

    return 0;
}

int push(int *a, int top, int elem)
{
    a[++top] = elem;

    return top;
}
int pop(int *a, int top)
{
    if(top == -1)
    {
        printf("空栈！\n");
        return -1;
    }
    printf("栈元素：%d\n", a[top--]);
    return top;
}
